#include "stdafx.h"
#include "imp_UIimage.h"
#include "..\clientinterfaces.h"
imp_UIimage::imp_UIimage():
m_angle(0.0f),
m_umin(0.0f),
m_umax(1.0f),
m_vmin(0.0f),
m_vmax(1.0f),
m_x_scale(1.0f),
m_y_scale(1.0f),
m_tex(0)
{

}

imp_UIimage::~imp_UIimage()
{
	if (m_tex)
	{
		g_pLTCTexInterface->ReleaseTextureHandle(m_tex);
		m_tex=NULL;
	}
}

void zuo_image::g_set_uv( LT_POLYFT4& poly,float umin,float vmin ,float umax,float vmax )
{
	poly.verts[0].u=umin;
	poly.verts[0].v=vmin;

	poly.verts[1].u=umax;
	poly.verts[1].v=vmin;

	poly.verts[2].u=umax;
	poly.verts[2].v=vmax;

	poly.verts[3].u=umin;
	poly.verts[3].v=vmax;

}

void zuo_image::g_set_xywh( LT_POLYFT4& poly,float x,float y, float w,float h )
{
	poly.verts[0].x = -w/2;
	poly.verts[0].y = h/2;
	poly.verts[0].z = SCREEN_NEAR_Z;
	poly.verts[1].x = w/2;
	poly.verts[1].y = h/2;
	poly.verts[1].z = SCREEN_NEAR_Z;
	poly.verts[2].x = w/2;
	poly.verts[2].y = -h/2;
	poly.verts[2].z = SCREEN_NEAR_Z;
	poly.verts[3].x = -w/2;
	poly.verts[3].y =-h/2; 
	poly.verts[3].z = SCREEN_NEAR_Z;
}


void zuo_image::g_set_color(LT_POLYFT4&poly,uint8 a,uint8 r ,uint8 g,uint8 b)
{
	poly.rgba.a = a;
	poly.rgba.r = r;
	poly.rgba.g = g;
	poly.rgba.b = b;
}
